<style scoped lang="scss">
.container {
	padding-top: R(20);
}

.terminal-info-content {
	margin: 0 R(20px);
	border-radius: R(20);
	background: #fff url(../../../common/images/newIcon/com-bg2.png) no-repeat;
	background-size: 100% auto;
}
</style>
<template>
	<div class="container">
		<div class="terminal-info-content" v-if="customData.agentName">
			<u-cell-item :arrow="false" hover-class="none" title="代理商编号：" :value="customData.agentNo">
				<i slot="right-icon" class="iconfont icon-niantie" @click="copy(customData.agentNo)"></i>
			</u-cell-item>
			<u-cell-item :arrow="false" hover-class="none" title="代理商名称：" :value="customData.agentName" />
			<u-cell-item :arrow="false" hover-class="none" title="商户号：" :value="customData.merchNo" />
			<u-cell-item :arrow="false" hover-class="none" title="商户名称：" :value="customData.merchName" />

			<u-cell-item :arrow="false" hover-class="none" title="政策：" :value="customData.policyName" />
			<u-cell-item :arrow="false" hover-class="none" title="政策代码：" :value="customData.policyCode" />
			<u-cell-item :arrow="false" hover-class="none" title="机具SN号：" :value="customData.serialno">
				<i slot="right-icon" class="iconfont icon-niantie" @click="copy(customData.serialno)"></i>
			</u-cell-item>
			<u-cell-item
				:arrow="false"
				hover-class="none"
				title="考核状态："
				:value="customData.checkStatus == -1 ? '考核失败' : customData.checkStatus == 0 ? '待考核' : customData.checkStatus == 1 ? '考核中' : '考核成功'"
			/>

			<u-cell-item :arrow="false" hover-class="none" title="考核开始时间：" :value="customData.startDate" class="agent-info-list-cell" />
			<u-cell-item :arrow="false" hover-class="none" title="考核结束时间：" :value="customData.endDate" class="agent-info-list-cell" />
			<u-cell-item :arrow="false" hover-class="none" title="考核金额：" :value="customData.checkAmount" />
			<u-cell-item :arrow="false" hover-class="none" title="实际交易金额：" :value="customData.totalAmount" />
			<u-cell-item :arrow="false" hover-class="none" title="考核交易类型名称：" :value="customData.totalTypeName" />
			<u-cell-item :arrow="false" hover-class="none" title="达标等级：" v-if="customData.cond" :value="customData.cond" />
			<!-- <u-cell-item :arrow="false" hover-class="none" title="达标奖励金额：" :value="customData.awardAmount" /> -->
			<u-cell-item :arrow="false" hover-class="none" title="订单号：" :value="customData.orderNo">
				<i slot="right-icon" class="iconfont icon-niantie" @click="copy(customData.orderNo)"></i>
			</u-cell-item>
			<u-cell-item :arrow="false" hover-class="none" title="达标日期：" v-if="customData.standardDate" :value="customData.standardDate" />
			<u-cell-item :arrow="false" hover-class="none" title="激活日期：" v-if="customData.activationDate" :value="customData.activationDate" />
		</div>
	</div>
</template>

<script>
import { getInfo, preMerchActivationCheckInfo } from '_a/tripartiteData';
export default {
	name: 'Info',
	data() {
		return {
			customData: {},
			type: '', //condCheck : 达标考核  ,termActive 商户终端激活
		};
	},
	onLoad(o) {
		const id = o.id;
		this.type = o.type;
		let title
		switch (this.type){
			case 'condCheck':
				title='商户达标考核'
				break;
			case 'termActive':
				title='商户终端激活'
				break;
			default:
				break;
		}
		uni.setNavigationBarTitle({
			title:title
		})
		this.initInfo(id);
	},
	methods: {
		initInfo(id) {
			if (this.type == 'condCheck') {
				getInfo(id).then(res => {
					if (res.code === 200) {
						this.customData = res.data;
					}
				});
			} else {
				preMerchActivationCheckInfo(id).then(res => {
					if (res.code === 200) {
						this.customData = res.data;
					}
				});
			}
		},
		copy(value) {
			uni.setClipboardData({
				data: value,
				success: () => {
					this.$tip.toast('复制成功!');
				}
			});
		}
	}
};
</script>
